﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Structure.Interfaces;

namespace Storage
{
    internal class Execute : iExecute
    {
        public Execute()
        { }

        public void ExecuteNonQuery(string sql,SqlConnection connection)
        {
            SqlCommand command = new SqlCommand(sql, connection);
            command.ExecuteNonQuery();           
        }

        public DataTable ExecuteQuery(string sql, SqlConnection connection)
        {
            SqlCommand command = new SqlCommand(sql, connection);
            SqlDataReader reader = command.ExecuteReader();
            DataTable dt = new DataTable();
            dt.Load(reader);          
            return dt;
        }
    }
}
